# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

pkgbase=python-pytest
pkgname=('python3-pytest')
pkgver=5.2.0
pkgrel=1
pkgdesc="Simple powerful testing with Python"
arch=('any')
license=('MIT')
url="https://pytest.org/"
depends=('python3' 
         'python3-atomicwrites'
         'python3-attrs'
         'python3-more-itertools'
         'python3-pluggy'
         'python3-py'
         'python3-setuptools'
         'python3-six')
makedepends=('python3-setuptools-scm')
source=("pytest-${pkgver}.tar.gz::https://github.com/pytest-dev/pytest/archive/${pkgver}.tar.gz")
sha512sums=('37cfd18cea0c92bb4202b03b6afde9896a2517b97a3a20c9d7fc47c3b1ae304de188feb695f805ee5480e887408b419c29659523d73f44dd42aab623505237fc')

prepare() {
  sed -i "s/'_pytest.vendored_packages'//" pytest-${pkgver}/setup.py
  sed -i 's/assert numentries == 0/assert numentries == 26/' pytest-${pkgver}/testing/python/collect.py
}

build() {
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
  
  cd "${srcdir}/pytest-${pkgver}"
  python3 setup.py build
}

package() {
  cd pytest-${pkgver}
  python3 setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
